package org.tsinghua.blockchain.entity;

import java.io.Serializable;

public class Message<T> implements Serializable {
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private String status;
	private T data;
	private String errorCode;
	private String errorContent;

	public static enum Status {
		SUCCESS("success"), FAILURE("failure");

		private String value;

		private Status(String value) {
			this.value = value;
		}

		public String getValue() {
			return this.value;
		}
	}

	public Message(Status status, T data, String errorCode, String errorContent) {
		this.status = status.getValue();
		this.data = data;
		this.errorCode = errorCode;
		this.errorContent = errorContent;
	}


	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public T getData() {
		return this.data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public String getErrorCode() {
		return this.errorCode;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public String getErrorContent() {
		return this.errorContent;
	}

	public void setErrorContent(String errorContent) {
		this.errorContent = errorContent;
	}

}
